package cn.community.care.module.system.controller.admin.chat;

import cn.community.care.framework.common.pojo.CommonResult;
import cn.community.care.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
import cn.community.care.module.system.service.chat.ChatService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.community.care.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - ai聊天")
@RestController
@RequestMapping("/system/ai")
@Validated
public class ChatController {
    @Resource
    private ChatService chatService;

    @PostMapping("/chat")
    @Operation(summary = "获取聊天")
    public CommonResult<String> createDept(@Valid @RequestBody ChatVo chatVo) {
        String chat = chatService.chat(chatVo.getContent());
        return success(chat);
    }
}
